/**
 * 存储token
 */

import { getToken } from "@/utils/auth"

// 每次初始化先从本地获取
const initState = getToken() || ''
export function login (state = initState, action) {
  if (action.type === 'token/login') {
    return action.token
  }
  if (action.type === 'clear/login') {
    return ''
  }
  return state
}